package com.tuozixuan.singleton1;;

/**
 * 无锁的线程安全单例模式<br/>
 * 通过在声明时直接实例化静态成员的方式来保证一个类只有一个实例<br/>
 * 
 * @see Singleton
 * @author tuozixuan
 *
 */
public class SingletonLockFree {

	private static SingletonLockFree instance = new SingletonLockFree();

	private SingletonLockFree() {
		System.out.println("Something is Instantiated.");
	}

	public static synchronized SingletonLockFree getInstance() {
		return instance;
	}

	public void doSomething() {
		System.out.println("Something is Done.");
	}
}
